package com.qububu.play.common.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qububu.db.dao.PlayArticleInfoDao;
import com.qububu.play.common.dto.ArticleDetailMsgDto;
import com.qububu.play.common.dto.ArticleInfoDto;
import com.qububu.play.common.service.PlayArticleService;

@Service
public class PlayArticleServiceImpl implements PlayArticleService {
	
	@Resource
	private PlayArticleInfoDao playArticleInfoDao;

	public List<ArticleInfoDto> getArticleListByActionId(int type, String actionId, int pageNum) {
		return playArticleInfoDao.getArticleListByActionId(type, actionId, pageNum);
	}

	public List<ArticleInfoDto> getArticleList(int type, int pageNum) {
		return playArticleInfoDao.getArticleListByArticleType(type, pageNum);
	}
	
	/**
	 * @功能 添加文章到数据库
	 * @author LH
	 * @return articleInfo 返回所添加文章信息
	 */
	public long doAddArticle(ArticleInfoDto articleInfo, ArticleDetailMsgDto articleMsg) {
		
		return playArticleInfoDao.doAddArticle(articleInfo, articleMsg);
	}
	
	/**
	 * @功能 通过id删除文章
	 * @author LH
	 */
	public void doDeleteArticle(String articleId){
		playArticleInfoDao.doDeleteArticle(articleId);
	}

	public List<ArticleDetailMsgDto> getArticleDetailsByMessageId(int articleIdInt, int pageNum) {
		return playArticleInfoDao.getArticleDetailsByMessageId(articleIdInt, pageNum);
	}

	public Map<String, Object> getFirstArticleAndSomeCommentByArticleId(int articleId) {
		return playArticleInfoDao.getFirstArticleAndSomeCommentByArticleId(articleId);
	}

	public long doAddArticleMessage(ArticleDetailMsgDto articleMessage) {
		return playArticleInfoDao.doAddArticleMessage(articleMessage);
	}

	public List<ArticleDetailMsgDto> getArticleInfoReplyByMsgId(int msgId) {
		return playArticleInfoDao.getArticleInfoReplyListByMsgId(msgId);
	}

}